﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
namespace BLO
{
    /// <summary>
    /// Summary description for Photo
    /// </summary>
    public class Photo
    {
         DTO.Photo info;
         DAO.Photo photoDAO;

        public Photo()
        {
            this.photoDAO = new DAO.Photo();
            this.info = new DTO.Photo();
        }

           /// <summary>
        /// Photo Information.
        /// </summary>
        public DTO.Photo Info
        {
            get { return this.info; }
            set { this.info = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ID"></param>
        public static Photo GetPhoto(String ID)
        {
            DAO.Photo photoDAO = new DAO.Photo();
            Photo photo = new  Photo();
            photo.Info = photoDAO.GetPhoto(ID);
            return photo;
        }

        /// <summary>
        /// Insert Photo information to database.
        /// </summary>
        public int Insert()
        {
            return photoDAO.InsertPhoto(this.info);
        }

        /// <summary>
        /// Update information to database.
        /// </summary>
        public int Update()
        {
            return photoDAO.UpdatePhoto(this.info);
        }
        public static ArrayList getListPhotoWithAlbum(String userID, int albumID)
        {
            DAO.Photo photoDAO = new DAO.Photo();
           
            return photoDAO.getListPhotoWithAlbum(userID,albumID);
        }
        /// <summary>
        /// Re-get all information from database about this Photos.
        /// </summary>
        public void Refresh()
        {
            this.info = photoDAO.GetPhoto(this.info.ID.ToString());
        }

        /// <summary>
        /// Delete this news from database.
        /// </summary>
        public int Delete()
        {
            return photoDAO.DeletePhoto(this.info);
        }
       
    }
}